[[ $(basename $(readlink -f $PORTAGE_CONFIGROOT/etc/make.profile)) == "embedded" ]] && . ${PORTDIR}/profiles/base/profile.bashrc

post_src_install() {
    echo "====================================== post_src_install(0)=====================" #by zlb
    echo "P = ${P}"
    echo "KEYWORDS = $KEYWORDS"
    echo "DEPEND = $DEPEND"
    echo "====================================== post_src_install(1)=====================" #by zlb
	[[ -d ${D} ]] || return 0        
	[[ ${E_MACHINE} == "" ]] && return 0
	cmdline=""        
	for EM in $E_MACHINE; do
		cmdline+=" -e ^${EM}[[:space:]]";        
	done
	output="$( cd ${D} && scanelf -RmyBF%a . | grep -v ${cmdline} )"
	[[ $output != "" ]] && { echo; echo "* Wrong EM_TYPE. Expected ${E_MACHINE}"; echo -e "${output}"; echo; exit 1; }
}

#   # We dont functionize this to avoid sandboxing.
#   if [[ $EBUILD_PHASE == "postinst" ]]; then
#       [[ $EMERGE_FROM != binary ]] && cross-fix-root ${CHOST}
#   fi


if [[ $EBUILD_PHASE == "postinst" ]]; then
    echo "====================================== \$EBUILD_PHASE == "postinst"(0)=====================" #by zlb
    echo "P = ${P}"
    echo "KEYWORDS = $KEYWORDS"
    echo "DEPEND = $DEPEND"
    echo "====================================== \$EBUILD_PHASE == "postinst"(1)=====================" #by zlb

    # This is the cross-fix-root from http://gentoo.mindzoo.de
    ####[[ $EMERGE_FROM != binary ]] && cross_fix_root ${CHOST}
    # This ensures that etc-update is handled before we do git commits
    ROOT=${ROOT} etc-update

    # This removes the /usr/share/gtk-doc directory
    rm -rf ${ROOT}/usr/share/gtk-doc

    # This commits newly installed packages to git for tracking
    ###cd ${ROOT} && git add . && git commit -a -m "=${CATEGORY}/${PF}, `date`";
fi

